package com.dabao.controller.admin;

import com.dabao.bean.Menu;
import com.dabao.controller.BaseController;
import com.dabao.util.UserHolder;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by dabao on 16/3/1.
 */
@Controller
@RequestMapping(value = "/admin")
public class IndexController extends BaseController {

    @Resource
    private UserHolder userHolder;

    @RequestMapping(value = "/index")
    public String index() {
        List<Menu> menus = userHolder.getUser().getMenus();
        Menu menu = menus.get(0).getChildren().get(0);
        return redirect(menu.getUrl());
    }
}
